﻿CREATE PROCEDURE [dbo].[s_ExportFromMegasys_AddOn_Bulk]
AS
SET IMPLICIT_TRANSACTIONS OFF
DECLARE cur CURSOR READ_ONLY FOR
SELECT LoanID FROM v_Borrower_0 WHERE SSN IS NULL

DECLARE @LoanID int
OPEN cur

FETCH NEXT FROM cur INTO @LoanID
WHILE @@fetch_status = 0 BEGIN
	PRINT @LoanID
	EXEC s_ExportFromMegasys_AddOn @LoanID
	IF dbo.Stop() = 1 BREAK
	FETCH NEXT FROM cur INTO @LoanID
END

CLOSE cur
DEALLOCATE cur

